package mspbots.next.ticket.core.points;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * mspbots.next.ticket.core.points.GradeTicketRegistration
 *
 * @author <a href="https://github.com/vnobo">Alex bob</a>
 * @date Created by 2020/11/30
 */
@Data
public class PointTicketRegistration implements Serializable {

    private final Long id;
    private final JsonNode entity;
    private final LocalDateTime time;

    private int point = 0;
    private List<?> detail;

    public PointTicketRegistration(JsonNode entity) {
        this.id = entity.get("id").longValue();
        this.entity = entity;
        this.time = LocalDateTime.now();
    }

    public static PointTicketRegistration withEntity(JsonNode entity) {
        return new PointTicketRegistration(entity);
    }

    public PointTicketRegistration point(int point) {
        this.point = point;
        return this;
    }

    public PointTicketRegistration detail(List<?> detail) {
        this.detail = detail;
        return this;
    }
}
